Repository navigation
wallet: Date a new wallet by this computer's clock - #217
Draft
BenWestgate wants to merge 2 commits into
Draft
BenWestgate wants to merge 2 commits into
BenWestgate wants to merge 2 commits into
Conversation
Bitcoin Core resolves an import timestamp of "now" to its tip's median time. On an offline signer that never synced, that is the genesis block, so every new wallet was born in 2009, and the watch-only copy Bails exports from it asks the online node to rescan from genesis, which a pruned node cannot do. A new wallet now takes this computer's clock, a day early like a recorded creation date, so a clock running up to a day fast cannot skip its first payments. Restores keep the recorded date. On a Core 32.1 regtest signer at genesis, the descriptors were dated 1296688602 (genesis) before and the clock less a day after; the signer still found a payment from blocks it synced later. Claude-Session: https://claude.ai/code/session_01N8jLK61uohaW6W7Y8AHnMb
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Ben · project thread
Follows Ben's review on BenWestgate/Bails#366 (comment): restores use the date the user gives, new wallets use the wall clock. Restores already do (#191). New wallets still imported with
"now".Bug. Core resolves
"now"to its tip's median time. On an offline signer that never synced, that's the genesis block. So every new wallet's descriptors are dated genesis, and Bitcoin QR (which now carries the source timestamp) makes the online node rescan from genesis, which a pruned CipherStick can't do.Change. One line in
BitcoinCore.initialize:"now"becomesint(time.time()) - 86400. The day early matchesparse_creation_date, so a clock up to a day fast can't make Core skip the wallet's first payments.check_historystill skips new wallets. This covers the GUI andms32 create/wallet --timestamp now.Checked. On a Core 32.1 regtest signer at genesis, descriptors were dated
1296688602(genesis) on 6c64411 and clock − 1 day here. The signer still found a 1.25 BTC payment from blocks it synced later.pytest: 659 passed, 2 skipped. The bip32-oracle modules (test_cli, test_generation, test_correction_*, one test_generic_hrp test) couldn't run here because the cloud proxy blocks the pinned GitHub tarball, so CI covers them. ruff and mypy are clean.Stacked on #113 (#190 → #191 → #113 → this). Needs Ben's security review (recovery path). Bails #332's pin should then move from b045908 to this head.
Generated by Claude Code